package com.atguigu.redisspringboot2.controller;

import com.atguigu.redisspringboot2.entity.User;
import com.atguigu.redisspringboot2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/getAllUsers")
    public List<User> getAllUsers() {
        // 从Redis中获取所有用户
        List<User> users = userService.getAllUsers();
        return users;
    }
}
